let ajax = function(opt){
    let xhr = new XMLHttpRequest();
    // new ActiveXObject('')
    
 
    xhr.open(opt.type||'post',opt.url,true);
    xhr.setRequestHeader("Content-Type", 'application/json');  
    xhr.onreadystatechange = function(){
        if(this.readyState==4&&this.status==200){
            opt.success&&opt.success();
        }
    }
    //_log('opt.data')
   /// _log(opt.data)
    //_log(JSON.stringify(opt.data))
    
    xhr.send(JSON.stringify(opt.data)); 
};

export default ajax;